package com.atguigu.jxc.controller;

import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.entity.GoodsTypeVo;
import com.atguigu.jxc.service.GoodsTypeService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.xml.ws.Service;
import java.util.List;
import java.util.Map;

/**
 * @author ：Shine
 * @description：
 * @date ：2021/3/22 23:35
 */

@RestController
@RequestMapping("/goodsType/")
public class GoodsTypeController {
    @Autowired
    private GoodsTypeService goodsTypeService;

    //    http://localhost:8080/goodsType/loadGoodsType
    @PostMapping("loadGoodsType")
    @RequiresPermissions(value = "商品管理")
    public String loadGoodsType() {
        return goodsTypeService.loadGoodsType();
    }

    //    http://localhost:8080/goodsType/save
//    新增分类
    @PostMapping("save")
    public ServiceVO save(String goodsTypeName, Integer pId) {
        return goodsTypeService.saveCategory(goodsTypeName, pId);
    }

//http://localhost:8080/goodsType/delete
//    删除分类
    @PostMapping("delete")
        public ServiceVO delete(Integer   goodsTypeId){
        return goodsTypeService.remove(goodsTypeId);
    }

}
